﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UofCASE.GreenPepe.Extensibility;
using UofCASE.GreenPepe.Runner.Events;
using GP = UofCASE.GreenPepe.GPTest;
using UofCASE.GreenPepe.Extensibility.Events;

namespace APLDTests {
    class MockGreenPepeService : IGreenPepeService {
        
        IList<TestInformation> testInfo = new List<TestInformation>();
        String testPath = @"Project\Tests\Test";
        String testPathExtension = ".html";
        String project = @"Project\Project.csproj";

        public MockGreenPepeService(int amountOfTests) {
            for (int i = 1; i <= amountOfTests; i++) {
                testInfo.Add(new TestInformation(testPath + i + testPathExtension, project));
            }
        }

        public IList<TestInformation> GetAllTests() {
            IList<TestInformation> resultList = new List<TestInformation>();
            foreach (var item in this.testInfo) {
                resultList.Add(item);
            }
            return resultList;
        }

        public String TestPath {
          get { return testPath; }
          set { testPath = value; }
        }
        
        public String TestPathExtension {
          get { return testPathExtension; }
          set { testPathExtension = value; }
        }

        public String Project {
          get { return project; }
          set { project = value; }
        }

        #region IGreenPepeService Members


        public void RunTest(TestInformation testInformation) {
                                    
        }

        public void RunTests(IList<TestInformation> testInformation) {
            IList<GP.Test> executedTests = new List<GP.Test>();
            if (TestExecutionCompleted != null){
                TestExecutionCompleted(this, null);            
            }
        }

        public event EventHandler<TestExecutionCompletedEventArgs> TestExecutionCompleted;


        #endregion
    }
}
